import Vue from 'vue'
import Router from 'vue-router'
// import Layout from '@/layout'
Vue.use(Router)
/**
 * 固定路由 不需要权限验证
 */
export const constantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  // {
  //   path: '/finance',
  //   component: Layout,
  //   redirect: '/finance/financeCurrent',
  //   meta: { title: '财务管理', icon: 'nav_caiwu', serveName: 'finance' },
  //   children: [
  //     {
  //       path: 'financeCurrent',
  //       name: 'financeCurrent',
  //       component: () => import('@/views/finance/financeCurrent/index'),
  //       noCache: true,
  //       meta: { title: '资金流水', serveName: 'financeCurrent' }
  //     }
  //   ]
  // },
  {
    path: '/venueList',
    component: () => import('@/views/venueList/index'),
    hidden: true
  },

  {
    path: '/fromShop',
    component: () => import('@/views/fromShop/index'),
    hidden: true
  },

  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },

  {
    path: '/empower',
    component: () => import('@/views/empower/index'),
    hidden: true
  }
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
